﻿<%@ Page Language="C#" MasterPageFile="~/Common.Master" AutoEventWireup="true" CodeBehind="BookCase.aspx.cs"
    Inherits="com.tiyma.web.User.BookCase" Title="体验码小说网,我的书架" %>

<asp:Content ID="Content1" ContentPlaceHolderID="phContent" runat="server">
    <link href="/style/my.css" rel="stylesheet" type="text/css" />
    
    <script src="/javascript/ajax.js" type="text/javascript"></script>
    <script>
    var m_cur_pannel="1";
    function ChangeTab(type)
    {
        if(type!=m_cur_pannel)
        {
            document.getElementById("chkAll").checked=false;
        }
        m_cur_pannel=type;
        var ulList=document.getElementById("ulList");
        for(var index=0;index<ulList.childNodes.length;index++)
        {
            ulList.childNodes[index].className="";
        }

        if(type=="1")
        {
            document.getElementById("<%=lblBookCaseCount.ClientID %>").style.display="";
            document.getElementById("<%=lblCurReadCount.ClientID %>").style.display="none";
            ulList.childNodes[0].className="hover";
            document.getElementById("tbBookCase").style.display="";
            document.getElementById("tbCurRead").style.display="none";
        }
        else if(type=="2")
        {
           document.getElementById("<%=lblBookCaseCount.ClientID %>").style.display="none";
            document.getElementById("<%=lblCurReadCount.ClientID %>").style.display="";
             ulList.childNodes[1].className="hover";
            document.getElementById("tbBookCase").style.display="none";
            document.getElementById("tbCurRead").style.display="";
        }
    }
    
    function CheckAll()
    {
        var chkName="bookCaseBook";
        if(m_cur_pannel=="2")
        {
            chkName="curReadBook";
        }
        var chkList=document.getElementsByName(chkName);
        
        var chkBookList="";
        if(typeof(chkList)!="undefined" && chkList!=null && chkList.length>0)
        {
            if(document.getElementById("chkAll").checked)
            {
                for(var index=0;index<chkList.length;index++)
                {
                    chkBookList+=chkList[index].value+"%";
                    chkList[index].checked=true;
                }
            }
            else
            {
                for(var index=0;index<chkList.length;index++)
                {
                    chkList[index].checked=false;
                }
            }
        }
        
       
    }
    
    function DownBook()
    {
    
         var chkName="bookCaseBook";
        if(m_cur_pannel=="2")
        {
            chkName="curReadBook";
        }
        var chkList=document.getElementsByName(chkName);
        
        var chkBookList="";
        if(typeof(chkList)!="undefined" && chkList!=null && chkList.length>0)
        {
            for(var index=0;index<chkList.length;index++)
            {
                if(chkList[index].checked)
                {
                    chkBookList+=chkList[index].value+"%";
                }
                
            }       
        }
        if(chkBookList=="")
        {
            alert("请选择要下架的小说!");
            return;
        }
        MyAjax.ExcuteScript("downbook",chkBookList,ShowBack);
    }
    
    function ShowBack(ret)
    {
        if(ret.value.indexOf("成功")>-1)
        {
            window.location.href="bookcase.aspx?type="+m_cur_pannel;
        }
        else
        {
            alert(ret.value);
        }
    }
    </script>
    <div class="qn_page">
        <div class="pos">
            <a href="index.aspx">体验码通行证</a> &gt; 我的信息 &gt; <span id="nowNav">我的书架</span></div>
        <div class="stage_side">
            <div class="sidenav">
                <dl class="exp">
                    <dt class="doc"><a onclick="return false" href="#">我的信息</a></dt>
                    <dd>
                        <ul>
                            <li id="default" rel="basic" class="off"><a target="" href="/user/index.aspx" rel="/user/index.aspx">
                                个人信息</a></li>
                            <li rel="info" class="col off"><a hidefocus="on" href="/user/bookcase.aspx" rel="/user/bookcase.aspx"
                                class="active">我的书架</a><span class="tab_text"></span></li>
                        </ul>
                    </dd>
                </dl>
            </div>
        </div>
        <div class="bookcase">
            <div class="tittab">
                <h3>
                    <span class="l"></span><span class="r"></span>
                    <ul id="ulList">
                        <li class="hover" style="cursor:hand;" onmouseover="ChangeTab('1')">我的书架</li>
                        <li style="cursor:hand;" onmouseover="ChangeTab('2')">最近阅读</li>
                    </ul>
                </h3>
                <h4>
                    <span class="gl">书架藏书：<asp:Label ID="lblBookCaseCount" runat="server" ForeColor="Red"></asp:Label><asp:Label ID="lblCurReadCount" runat="server" ForeColor="Red"></asp:Label>&nbsp;本小说</span>
                </h4>
                <form name="pageListForm" action="" runat="server">
                <table class="wdlist">
                    <thead>
                        <tr class="bg2">
                            <th class="cb">
                                选择
                            </th>
                            <th class="lb">
                                类别
                            </th>
                            <th class="zp">
                                作品名
                            </th>
                            <th class="zj">
                                最新章节
                            </th>
                            <th class="sj">
                                更新时间
                            </th>
                            <th class="zz">
                                作者
                            </th>
                            <th class="zt">
                                状态
                            </th>
                        </tr>
                    </thead>
                    <tbody id="tbBookCase">
                    <asp:Repeater ID="rptBookCase" runat="server">
                    <ItemTemplate>
                        <tr class="bg2">
                            <td class="cb">
                                <input type="checkbox" value="<%#Eval("bookName") %>#1" name="bookCaseBook" />
                            </td>
                            <td class="lb">
                                <a target="_blank" href="/bookList.aspx?k=<%# HttpUtility.UrlEncode( Eval("bookCategory").ToString()) %>">[<%#Eval("bookCategory") %>]</a>
                            </td>
                            <td class="zp">
                                <a target="_blank" href="/book.aspx?bookId=<%#Eval("bookId") %>&siteId=<%#Eval("siteId") %>" title="<%#Eval("bookName") %>"><%#Eval("bookName") %>
                                </a>
                            </td>
                            <td class="zj">
                                <a target="_blank" href="/chapter.aspx?bookId=<%#Eval("bookId") %>&siteId=<%#Eval("siteId") %>&chapterId=<%#Eval("lastUpdateChapterId") %>" title="<%#Eval("lastUpdateChapterName") %>">
                                   <%#Eval("lastUpdateChapterName")%> </a>&nbsp;
                            </td>
                            <td class="sj">
                               <%# Convert.ToDateTime( Eval("lastUpdateTime").ToString()).ToString("yyyy-MM-dd") %>
                            </td>
                            <td class="zz">
                                <a target="_blank" href="/bookList.aspx?k=<%# HttpUtility.UrlEncode( Eval("authorName").ToString()) %>" title="<%#Eval("authorName") %>"><%#Eval("authorName") %> </a>
                            </td>
                         
                            <td class="zt">
                                <font class="ztb">连载</font>
                            </td>
                        </tr>
                        </ItemTemplate>
                        </asp:Repeater>
                    </tbody>
                    
                     <tbody id="tbCurRead" style="display:none;">
                    <asp:Repeater ID="rptCurRead" runat="server">
                    <ItemTemplate>
                        <tr class="bg2">
                            <td class="cb">
                                <input type="checkbox" value="<%#Eval("bookId") %>#2" name="curReadBook" />
                            </td>
                            <td class="lb">
                                &nbsp;
                            </td>
                            <td class="zp">
                                <a target="_blank" href="/book/<%#Eval("bookId") %>/" title="<%#Eval("bookName") %>"><%#Eval("bookName") %>
                                </a>
                            </td>
                            <td class="zj">
                                <a target="_blank" href="/reader/<%#Eval("siteId") %>/<%#Eval("chapterId") %>/" title="<%#Eval("chapterName") %>">
                                   <%#Eval("chapterName")%> </a>&nbsp;
                            </td>
                            <td class="sj">
                               &nbsp;
                            </td>
                            <td class="zz">
                                 &nbsp;
                            </td>
                         
                            <td class="zt">
                                <font class="ztb">连载</font>
                            </td>
                        </tr>
                        </ItemTemplate>
                        </asp:Repeater>
                    </tbody>
                </table>
                <div>
                </div>
                <table>
                    <tbody>
                        <tr>
                            <td height="35" class="bottom" bgcolor="#FFFFFF">
                                <div>
                                    <input type="checkbox" value="checkbox" onclick="CheckAll()" id="chkAll"
                                        name="chkAll">&nbsp;&nbsp;全选 &nbsp;&nbsp;
                                      <input type="button" value="下 架" class="btnbookcase" onclick="javascript:return DownBook();" />
                          
                                   
                            </td>
                        </tr>
                    </tbody>
                </table>
              <asp:Label ID="lblScript" runat="server"></asp:Label>
                </form>
            </div>
        </div>
        <div class="fthr">
        </div>
    </div>
</asp:Content>
